﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

public partial class PlatForm_CoursewareDetail : System.Web.UI.Page
{
	private PX.Coureseware.Component clsCoursewareComp;
	private PX.Coureseware.Entity clsCourseware = new PX.Coureseware.Entity();
	private int nCoursewareID = 0;

	public PlatForm_CoursewareDetail()
		: base()
	{
		clsCoursewareComp = new PX.Coureseware.Component(Page);
	}

	protected void Page_Load(object sender, EventArgs e)
	{
		string strFileExt = "";

		try
		{
			nCoursewareID = Convert.ToInt32(Request["CoursewareID"]);
		}
		catch
		{
			nCoursewareID = 0;
		}

		clsCourseware = clsCoursewareComp.GetOne(nCoursewareID);

		if (clsCourseware != null)
		{
			LabCoursewareName.Text = clsCourseware.Name;
			strFileExt = TonyNet4V1.CommonFunction.GetFileExtension(clsCourseware.Name);
			if (strFileExt == "mp4" || strFileExt == "flv")
			{
				divDownload.Visible = false;
				frameOnLinePlay.Attributes.Add("src", "../CuPlay/OnLinePlay.aspx?Path=" + clsCourseware.Path);
				frameOnLinePlay.Attributes.Add("onload", "iFrameHeight('" + frameOnLinePlay.ClientID.ToString() + "')");
			}
			else
			{
				divDownload.Visible = true;
				HLinkDownLoad.NavigateUrl = clsCourseware.Path;
			}
		}
		else
		{
			TonyNet4V1.ShowMessageAlert.ShowError(Page, "CoursewareID错误！");
		}
	}
}